﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Puzzles_IQ
{
    class Music
    {
        private WMPLib.WindowsMediaPlayer player = new WMPLib.WindowsMediaPlayer();

        public int Volume 
        { 
            get 
            { 
                return player.settings.volume;
            }
            set 
            {
                if ((this.Volume <= 100) && (this.Volume >= 0))
                {
                    player.settings.volume  = value; 
                }
            }
        }

        public void PlayMusicFromURL(string url)
        {
            player.URL = url;
            player.settings.volume = 90;
            player.controls.play();
        }

        public void PlayerStop()
        {
            player.controls.stop();
        }

        public void ChangePlayerVolume(int vol)
        {
            int x = this.Volume;
            this.Volume = x+=vol;
        }
    }
}
